package code;

public abstract class ContainerCell extends Cell
{
	private MovableObject front;
	
	public ContainerCell(String texture){
		super(texture);
		front = null;
	}
	
	public void placeObject(MovableObject obj)
	{
		front = obj;
		obj.setCell(this);
		
	}
	
	public MovableObject takeObject()
	{
		MovableObject aux = front;
		front = null;
		return aux;
	}
	
	public boolean isEmpty()
	{
		return front == null;
	}
	
	public String PRINT() //sacar despues
	{
		{
			if (isEmpty())
				return this.getTexture();
			return front.PRINT();
		}
	}
	
	@Override
	public boolean makeAvailable(Direction dir)
	{
		if (this.isEmpty())
			return true;
		
		return front.attemptMove(dir);
	}
}

